/*
 * @Author: silence silence9685@163.com
 * @Date: 2023-07-21 15:49:58
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2023-12-15 16:49:06
 * @FilePath: \ems_neutral_app\lib\pages\Mine\Fault\FaultPage.dart
 * @Description: 故障处理
 */
import 'package:ems_neutral_app/base/SilScaffold.dart';
import 'package:ems_neutral_app/pages/Mine/Fault/FaultListPage.dart';
import 'package:ems_neutral_app/pages/Mine/Language/SilLocalizations/SilLocalizations.dart';
import 'package:ems_neutral_app/utils/color/ColorUtils.dart';
import 'package:flutter/material.dart';
import 'package:sil_base_widget_package/combined_widget/tabbar/SilTopTabBarWidget.dart';

class FaultPage extends StatefulWidget {
  const FaultPage({super.key});

  @override
  State<FaultPage> createState() => _FaultPageState();
}

class _FaultPageState extends State<FaultPage> {
  List<String>? _titles;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    _titles = [];
    _titles?.add(LangOf(context)?.faultList?.pending ?? "");
    _titles?.add(LangOf(context)?.faultList?.completed ?? "");

    return SilScaffold(
      sideMargin: 0,
      title: LangOf(context)?.mine?.fault_statistice,
      body: mainWidget(),
    );
  }

  mainWidget() {
    return Container(
      child: SilTopTabBarWidget(
        itemBuilder: (p0, index) {
          return FaultListPage(isFinished: index != 0);
        },
        titles: _titles,
        isShowCenter: true,
        selectedLabelColor: ColorUtils.color_font_main,
        unselectedLabelColor: ColorUtils.color_subtitle,
        selectedIndicatorColor: Colors.transparent,
      ),
    );
  }
}
